package cn.iocoder.yudao.module.pmp.controller.admin.project.vo;

import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.TransPojo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.math3.stat.descriptive.summary.Product;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "管理后台 - 项目登记 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProjectRespVO extends BaseDO implements TransPojo {

    @Schema(description = "编号，主键自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "17195")
    @ExcelProperty("编号，主键自增")
    private Long id;

    @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
    @ExcelProperty("项目名称")
    private String name;

    @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("项目编号")
    private String projcetNo;

    @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "16987")
    @ExcelProperty("客户编号")
    @Trans(type = TransType.SIMPLE, target = CrmCustomerDO.class, fields = "name", ref = "customerName")
    private Long customerId;

    @Schema(description = "商机编号", example = "28972")
    @ExcelProperty("商机编号")
    @Trans(type = TransType.SIMPLE, target = CrmBusinessDO.class, fields = "name", ref = "businessName")
    private Long businessId;

    @Schema(description = "合同编号", example = "6111")
    @ExcelProperty("合同编号")
    @Trans(type = TransType.SIMPLE, target = CrmContractDO.class, fields = "name", ref = "contractName")
    private Long contractId;

    @Schema(description = "最后跟进时间")
    @ExcelProperty("最后跟进时间")
    private LocalDateTime contactLastTime;

    @Schema(description = "项目经理编号", example = "31032")
    @ExcelProperty("项目经理编号")
    @Trans(type = TransType.SIMPLE, target = AdminUserDO.class, fields = "nickname", ref = "ownerUserName")
    private Long ownerUserId;

    @Schema(description = "工作流编号", example = "23971")
    @ExcelProperty("工作流编号")
    private String processInstanceId;

    @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty("审批状态")
    private Integer auditStatus;

    @Schema(description = "进场日期")
    @ExcelProperty("进场日期")
    private LocalDateTime jcDate;

    @Schema(description = "开始时间")
    @ExcelProperty("开始时间")
    private LocalDateTime startTime;

    @Schema(description = "结束时间")
    @ExcelProperty("结束时间")
    private LocalDateTime endTime;

    @Schema(description = "项目金额", example = "8571")
    @ExcelProperty("项目金额")
    private BigDecimal projcetPrice;

    @Schema(description = "整单折扣")
    @ExcelProperty("整单折扣")
    private BigDecimal discountPercent;

    @Schema(description = "项目状态", example = "2")
    @ExcelProperty("项目状态")
    private String projcetStatus;

    @Schema(description = "是否提前进场")
    @ExcelProperty("是否提前进场")
    private int sftqjc;

    @Schema(description = "提前进场日期")
    @ExcelProperty("提前进场日期")
    private LocalDateTime tqjcDate;

    @Schema(description = "商务负责人", example = "28514")
    @ExcelProperty("商务负责人")
    @Trans(type = TransType.SIMPLE, target = AdminUserDO.class, fields = "nickname", ref = "signUserName")
    private Long signUserId;

    @Schema(description = "项目简介", example = "你猜")
    @ExcelProperty("项目简介")
    private String remark;


    @ExcelProperty("客户名称")
    private String customerName;

    @ExcelProperty("合同名称")
    private String contractName;

    @ExcelProperty("商机名称")
    private String businessName;

    @ExcelProperty("项目经理名称")
    private String ownerUserName;

    @ExcelProperty("商务负责人")
    private String signUserName;

    private List<CrmBusinessRespVO.Product> products;

}
